home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / Graphic Elements 3 / GEMisc / SFXProcs.c < prev    next >
Text File  |  1995-08-25  |  2KB  |  99 lines

  1. /*
  2.     SFXProcs.h
  3.     
  4.     Special effects for Graphic Elements
  5.     
  6.     Copyright 1994 by Al Evans. All rights reserved.
  7.     
  8.     6/9/94
  9.     
  10. */
  11.  
  12. #include "SFXProcs.h"
  13. #include "Rects.h"
  14.  
  15.  
  16. pascal void SFXHWipe(SFXCtrlrPtr controller)
  17. {
  18.     Rect        destRect;
  19.     CGrafPtr    savePort;
  20.     GDHandle    gd;
  21.     GrafElPtr    element = (GrafElPtr) controller;
  22.     short        cpyWidth;
  23.     
  24.     switch(controller->currentStep) {
  25.         case -1:
  26.             break;
  27.         case 0:
  28.             break;
  29.         default:
  30.             GetGWorld(&savePort, &gd);
  31.             SetGWorld(element->graphWorld, nil);
  32.             destRect = element->graphRect;
  33.             cpyWidth = RectWidth(&destRect) * controller->currentStep / controller->nSteps;
  34.             if (controller->forward)
  35.                 destRect.right = destRect.left + cpyWidth;
  36.             else
  37.                 destRect.left = destRect.right - cpyWidth;
  38.             CopyBits(&((GrafPtr) controller->sfxSrc)->portBits, 
  39.                         &((GrafPtr) element->graphWorld)->portBits,
  40.                         &destRect, &destRect, srcCopy, nil);
  41.             SetGWorld(savePort, gd);
  42.             
  43.             
  44.             break;
  45.     }
  46. }
  47.  
  48. pascal void SFXVWipe(SFXCtrlrPtr controller)
  49. {
  50.     Rect        destRect;
  51.     CGrafPtr    savePort;
  52.     GDHandle    gd;
  53.     GrafElPtr    element = (GrafElPtr) controller;
  54.     short        cpyHeight;
  55.     
  56.     switch(controller->currentStep) {
  57.         case -1:
  58.             break;
  59.         case 0:
  60.             break;
  61.         default:
  62.             GetGWorld(&savePort, &gd);
  63.             SetGWorld(element->graphWorld, nil);
  64.             destRect = element->graphRect;
  65.             cpyHeight = RectHeight(&destRect) * controller->currentStep / controller->nSteps;
  66.             if (controller->forward)
  67.                 destRect.bottom = destRect.top + cpyHeight;
  68.             else
  69.                 destRect.top = destRect.bottom - cpyHeight;
  70.             CopyBits(&((GrafPtr) controller->sfxSrc)->portBits, 
  71.                         &((GrafPtr) element->graphWorld)->portBits,
  72.                         &destRect, &destRect, srcCopy, nil);
  73.             SetGWorld(savePort, gd);
  74.             
  75.             
  76.             break;
  77.     }
  78. }
  79.  
  80. pascal void SFXBlink(SFXCtrlrPtr controller)
  81. {
  82.     GWorldPtr    tmpGWorld;    
  83.     
  84.     switch(controller->currentStep) {
  85.         case -1:
  86.             break;
  87.         case 0:
  88.             break;
  89.         default:
  90.             //Total number of switches must be even
  91.             if ((controller->currentStep == controller->nSteps) && (controller->nSteps & 1))
  92.                 return;
  93.             tmpGWorld = controller->sfxSrc;
  94.             controller->sfxSrc = ((GrafElPtr) controller)->graphWorld;
  95.             ((GrafElPtr) controller)->graphWorld = tmpGWorld;
  96.             break;
  97.     }
  98. }
  99.